package com.dc.ssjt.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dc.ssjt.config.db.DataSource;
import com.dc.ssjt.config.db.DataSourceNames;
import com.dc.ssjt.entity.Account;
import com.dc.ssjt.mapper.AccountMapper;
import com.dc.ssjt.service.AccountService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * 账户服务，业务逻辑
 *
 * @author duchao
 */
@Slf4j
@Service
public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> implements AccountService {


    /**
     * 扣除账户钱
     *
     * @param userId 用户id
     * @param money  扣款金额
     */
    @DataSource(name = DataSourceNames.DS_ACCOUNT)
    @Override
    public void decrease(Long userId, BigDecimal money) {
        baseMapper.decrease(userId,money);
    }
}
